#!/bin/bash

SUM=0;


function1(){

	#if [ $NUM1 -eq $NUM2 ];then
	#echo $NUM1

	if [ $NUM1 -lt $NUM2 ];then
		for ((i=$NUM1;i<=$NUM2;i++))
		do
			SUM=$[$SUM+$i];
		done
		echo $SUM;
	else
		for((i=$NUM2;i<=$NUM1;i++))
		do
			SUM=$[$SUM+$i];
		done
		echo $SUM;
	fi

}

read -p "请输入第一个数" NUM1
read -p "请输入第二个数" NUM2
function1 NUM1 NUM2
